import { useStore } from '@/stores/user'
export const uploadFiles = (data) => {
  const UserStore = useStore()
  let formData= {
    'Authorization':'Bearer ' + UserStore.getToken
  }
  return new Promise((resolve, reject) => {
    uni.uploadFile({
      url: import.meta.env.VITE_APP_BASE_API+'/oss/file/upload', //仅为示例，非真实的接口地址
      filePath: data.file,
      name: 'file',
      header:{
        'Authorization':'Bearer ' + UserStore.getToken
      },
      formData,
      success (res){
        console.log('data输出日志',res)
         let data =JSON.parse(res.data)

        return resolve(data.data)
      },
      fail(err){
        return reject(err)
      }
    })
  }
  )
}
